package com.handmark.pulltorefresh.library.internal;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.ScrollView;

public class MyScrollView extends ScrollView {
	private ScrollViewListener onScrollViewListener;
	
	public MyScrollView(Context context) {
		super(context);
	}
	
	public MyScrollView(Context context, AttributeSet attrs) {
		super(context, attrs);
	}
	
	public MyScrollView(Context context, AttributeSet attrs, int defStyle) {
		super(context, attrs, defStyle);
	}
	
	public void setOnScrollViewListener(ScrollViewListener onScrollViewListener){
		if(onScrollViewListener != null){
			this.onScrollViewListener = onScrollViewListener;
		}
	}
	
	@Override
	protected void onScrollChanged(int l, int t, int oldl, int oldt) {
		super.onScrollChanged(l, t, oldl, oldt);
		onScrollViewListener.onScrollChanged(this, l, t, oldl, oldt);
	}
	
	public interface ScrollViewListener{
		void onScrollChanged(MyScrollView scrollView, int l, int t, int oldl, int oldt);
	}
	
}
